package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Zhengxieweiyuanpinyibiao;
import com.ruoyi.system.service.IZhengxieweiyuanpinyibiaoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 政协委员评价表Controller
 * 
 * @author Quilan
 * @date 2023-12-04
 */
@RestController
@RequestMapping("/system/zhengxieweiyuanpinyibiao")
public class ZhengxieweiyuanpinyibiaoController extends BaseController
{
    @Autowired
    private IZhengxieweiyuanpinyibiaoService zhengxieweiyuanpinyibiaoService;

    /**
     * 查询政协委员评价表列表
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:list')")
    @GetMapping("/list")
    public TableDataInfo list(Zhengxieweiyuanpinyibiao zhengxieweiyuanpinyibiao)
    {
        startPage();
        List<Zhengxieweiyuanpinyibiao> list = zhengxieweiyuanpinyibiaoService.selectZhengxieweiyuanpinyibiaoList(zhengxieweiyuanpinyibiao);
        return getDataTable(list);
    }

    /**
     * 导出政协委员评价表列表
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:export')")
    @Log(title = "政协委员评价表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Zhengxieweiyuanpinyibiao zhengxieweiyuanpinyibiao)
    {
        List<Zhengxieweiyuanpinyibiao> list = zhengxieweiyuanpinyibiaoService.selectZhengxieweiyuanpinyibiaoList(zhengxieweiyuanpinyibiao);
        ExcelUtil<Zhengxieweiyuanpinyibiao> util = new ExcelUtil<Zhengxieweiyuanpinyibiao>(Zhengxieweiyuanpinyibiao.class);
        util.exportExcel(response, list, "政协委员评价表数据");
    }

    /**
     * 获取政协委员评价表详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zhengxieweiyuanpinyibiaoService.selectZhengxieweiyuanpinyibiaoById(id));
    }

    /**
     * 新增政协委员评价表
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:add')")
    @Log(title = "政协委员评价表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Zhengxieweiyuanpinyibiao zhengxieweiyuanpinyibiao)
    {
        return toAjax(zhengxieweiyuanpinyibiaoService.insertZhengxieweiyuanpinyibiao(zhengxieweiyuanpinyibiao));
    }

    /**
     * 修改政协委员评价表
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:edit')")
    @Log(title = "政协委员评价表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Zhengxieweiyuanpinyibiao zhengxieweiyuanpinyibiao)
    {
        return toAjax(zhengxieweiyuanpinyibiaoService.updateZhengxieweiyuanpinyibiao(zhengxieweiyuanpinyibiao));
    }

    /**
     * 删除政协委员评价表
     */
    @PreAuthorize("@ss.hasPermi('system:zhengxieweiyuanpinyibiao:remove')")
    @Log(title = "政协委员评价表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zhengxieweiyuanpinyibiaoService.deleteZhengxieweiyuanpinyibiaoByIds(ids));
    }
}
